x86/pagewalk: Fix determination of Protection Key access rights
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 16 May 2017 14:47:33 +0000 (15:47 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 19 May 2017 14:41:45 +0000 (15:41 +0100)
commit8f2e3d8913bba06651d9021b6f925bdcd1060f4a
tree0e5396d1ac494655f91e0605975b7465f31203b8
parent0d6968635ce51a8ed7508ddcf17b3d13a462cb27
x86/pagewalk: Fix determination of Protection Key access rights

 * When fabricating gl1e's from superpages, propagate the protection key as
   well, so the protection key logic sees the real key as opposed to 0.

 * Experimentally, the protection key checks are performed ahead of the other
   access rights.  In particular, accesses which fail both protection key and
   regular permission checks yield PFEC_prot_key in the resulting pagefault.

 * Protection keys apply to all data accesses to user-mode addresses,
   including accesses from supervisor code.  PKRU WD applies to any data
   write, not just to mapping which are writable.  However, a supervisor
   access without CR0.WP bypasses any protection from protection keys.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Release-acked-by: Julien Grall <julien.grall@arm.com>
xen/arch/x86/mm/guest_walk.c